package com.gitee.chenyaohua.oa.exception;

import com.gitee.chenyaohua.oa.from.dto.Status;
import com.gitee.chenyaohua.oa.from.vo.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@Slf4j
@RestControllerAdvice
public class ExceptionController {
	
	@ExceptionHandler(value = Exception.class)
    @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
    public Result<String> HandleException(Exception e){
        log.error("系统内部异常，异常信息：", e);
        return new Result<>(Status.FAIL.getIndex(),null,"系统内部异常");
    }

}
